{% extends 'index.html' %}

{% block 'content' %}
    <h1>API Documentation</h1>
    <p>
        The data of this site is also available in a machine-readable format (JSON).
        Our API serves the same data as the application; especially, no answers that
        are visible in the API if they have not been published in the application.
    </p>
    <p>
        Feel free to fetch this dataset and analyze it as you wish. If you've done
        something interesting, consider dropping us a note :)
    </p>
    <h2>URL</h2>
    <ul>
        <li><a href="{% url 'v1' %}">{{ request.get_host }}{% url 'v1' %}</a></li>
    </ul>
    <h2>Data Structure</h2>
    <ul>
        <li>
            Politicians
            <ul>
                <li><strong>id</strong>: The id of the politician</li>
                <li><strong>first_name</strong>: The first name of the politician</li>
                <li><strong>last_name</strong>: The last name of the politician</li>
                <li><strong>is_member_of_parliament</strong>: Is the politician a member of the parliament?</li>
                <li><strong>image</strong>: URL to the image <em>(can be null)</em></li>
                <li><strong>state</strong>: Name of the state <em>(can be null)</em> </li>
                <li>
                    <strong>party</strong> <em>(can be null)</em>
                    <ul>
                        <li><strong>name</strong>: The long name of the party</li>
                        <li><strong>shortname</strong>: The short name of the party <em>(can be null)</em></li>
                    </ul>
                <li><strong>past_contributions</strong>: Past contributions of the politician</li>
                <li><strong>future_plans</strong>: Future plans of the politician</li>
                <li>
                    <strong>answers</strong>
                    <ul>
                        <li><strong>question_id</strong>: The id of the referring question</li>
                        <li><strong>answer</strong>: Agreement level to the question (is between 0 - 10)</li>
                        <li><strong>note</strong>: Additional note to the answer</li>
                    </ul>
                </li>
            </ul>
        </li>
        <li>
            Categories
            <ul>
                <li><strong>id</strong>: The id of the category</li>
                <li><strong>name</strong>: The name of the category (de, fr, it)</li>
            </ul>
        </li>
        <li>
            Questions
            <ul>
                <li><strong>id</strong>: The id of the question</li>
                <li><strong>category_id</strong>: The id of the referring category</li>
                <li><strong>text</strong>: The question text (de, fr, it)</li>
                <li><strong>description</strong>: A better description of the question (de, fr, it)</li>
                <li><strong>preferred_answer</strong>: The preferred answer given by FSFE (is between 0 - 10)</li>
            </ul>
        </li>
    </ul>
{% endblock %}
